package com.cheer.controller;

import com.cheer.common.Page;
import com.cheer.common.Result;
import com.cheer.dto.OaOpinionQueryDTO;
import com.cheer.service.OaOpinionService;
import com.cheer.vo.OaOpinionListVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cheer
 */
@RestController
@RequestMapping("/opinion")
public class OaOpinionController {

    @Autowired
    private OaOpinionService oaOpinionService;

    @ApiOperation("查询意见列表")
    @PostMapping("/list")
    @PreAuthorize("@permissionValidator.isAdmin()")
    public Result<Page<OaOpinionListVO>> list(@RequestBody OaOpinionQueryDTO oaOpinionQueryDTO) {
        return Result.success(oaOpinionService.list(oaOpinionQueryDTO));
    }
}
